<template>
    <i-tab-bar :current="current" @change="changetabBar" fixed='true' color='#c78550'>
        <i-tab-bar-item key="homepage" :img="'../../../static/tabBar/home.png'" :current-img="'../../../static/tabBar/home_active.png'" title="首页"></i-tab-bar-item>
        <i-tab-bar-item key="sellbook" :img="'../../../static/tabBar/seeBook.png'" :current-img="'../../../static/tabBar/seeBook_active.png'" title="卖书"></i-tab-bar-item>
        <i-tab-bar-item key="cart" :img="'../../../static/tabBar/cart.png'" :current-img="'../../../static/tabBar/cart.png'" count="3" title="购物车"></i-tab-bar-item>
        <i-tab-bar-item key="market" :img="'../../../static/tabBar/market.png'" :current-img="'../../../static/tabBar/market_active.png'" title="市集"></i-tab-bar-item>
        <i-tab-bar-item key="mine" :img="'../../../static/tabBar/mine.png'" :current-img="'../../../static/tabBar/mine_active.png'" title="我的"></i-tab-bar-item>
    </i-tab-bar>
</template>
<script>
export default {
    props: ['current'],
    methods: {
        changetabBar(detail) {
            let current = detail.target.key
            if (current === 'homepage') {
                wx.redirectTo({
                    url: '../index/main'
                })
            } else if (current === 'sellbook') {
                wx.redirectTo({
                    url: '../booksToMoney/main'
                })
            } else if (current === 'cart') {
                wx.navigateTo({
                    url: '../cart/main'
                })
            } else if (current === 'market') {
                wx.redirectTo({
                    url: '../market/main'
                })
            } else if (current === 'mine') {
                wx.redirectTo({
                    url: '../mine/main'
                })
            }
        }
    }
}
</script>